$(function(){
		 $("#suggest_ul").hide(0);
});
$(function(){
	$("#suggest_input").keyup(function(){
			if($("#suggest_input").val().length<=0){
				$("#li_id").val("");
				$("#suggest_ul").hide(0);
				return; 
			}
		var listTxt = '',li = '', bEqual=false;
		
		  $.ajax({
			    "url" : "call/jh_mem.php",
				"data" : {action:'fuzzyGetDname_c', dname:$("#suggest_input").val(),dtype:$("#lid_id").val()},
				"dataType":"json",
				"type": 'POST', 
				"success":function(data){
					$("#suggest_ul").show(0);
					var contents="";
					var li_id="";
					for(var i in data) {
						var keywords = data[i].dname;
						var id = data[i].id;
						contents=contents+"<li data-id='"+id+"'>"+keywords+"</li>";
						li_id=id;
						}
						$("#suggest_ul").html(contents); 
						$("#li_id").val(li_id);
					}          
			});
			});  
			$(function(){
				/* $("#suggest_input").keyup(function(){
					setInterval(changehover,50);
					function changehover(){
						$("#suggest_ul li").hover(function(){ $(this).css("background","#eee");},function(){ $(this).css("background","#fff");});
						$("#suggest_ul li").click(function(){ $("#suggest_input").val($(this).html());$("#suggest_ul").hide(0);});
					}
				}); */
			});
			$("#suggest_ul").on("click","li",function(e){
				var target = $(e.currentTarget);
				var id = target.data("id");
				$("#suggest_input").val(target.text());
				$("#li_id").val(id);
				$("#suggest_ul").hide(0);
			})
	
});


